fix: correct CLI command hints and messaging (npx-aware, claim/remove semantics)#188
fix: correct CLI command hints and messaging (npx-aware, claim/remove semantics)#188nicknisi wants to merge 1 commit into
Conversation
… semantics) Messaging-accuracy sweep with no behavior changes to install/auth flows. Area 1 — copy-pasteable command hints: route ~28 hardcoded `workos <subcommand>` hint sites through formatWorkOSCommand()/getWorkOSCommand() so users who launched via `npx workos@latest ...` are told to run the npx form instead of a bare `workos` that npx never installed. Adds a repo-walk regression guard (command-hints-guard.spec.ts) with a curated 4-entry allowlist for genuinely-static strings; it fails on any new unrouted hint. Area 2 — credential-source-aware copy: thread context.credentialSource into agentOptions and branch getOrAskForWorkOSCredentials so "Using the WorkOS credentials you provided" prints only for cli/manual (suppressed for device/stored/env, gated on human output). Adds a source field to staging:success so the CLI/headless adapters say the right thing instead of "retrieved automatically" for both fresh and reused environments. Area 3 — honest semantics + accurate migrations copy: env remove now states it is local-only (help + runtime warning + localOnly/wasUnclaimed JSON fields, warning that an unclaimed env's claim token is lost); env claim states claiming is permanent (help + runtime note + permanent JSON field); migrations description advertises the generic-CSV path (e.g. Supabase) via a shared MIGRATIONS_DESCRIPTION constant, and the JSON help subcommand list is reconciled with @workos/migrations v2.5.0 (adds export/export-template/ generate-package-template/validate-package; process-role-definitions → process-roles). Validation: build, typecheck, and full test suite (2277) pass; the hint guard is now a pnpm test gate. Reviewed via validation-only fallback (the ideation reviewer subagent was unavailable in this headless run).
| { name: 'transform-firebase', description: 'Transform Firebase JSON to WorkOS format' }, | ||
| { name: 'analyze', description: 'Analyze import errors and generate retry plan' }, | ||
| { name: 'enroll-totp', description: 'Enroll TOTP MFA factors' }, | ||
| { name: 'process-role-definitions', description: 'Create roles and assign in WorkOS' }, | ||
| { name: 'process-roles', description: 'Create roles and assign permissions in WorkOS' }, | ||
| { name: 'wizard', description: 'Guided interactive migration wizard' }, | ||
| ], |
There was a problem hiding this comment.
🔍 Migrations help-json subcommands should be verified against actual package exports
The help-json.ts migrations subcommand list was updated: process-role-definitions was renamed to process-roles, and new entries were added (export, export-template, generate-package-template, validate-package). Since this is a static registry that must mirror the actual @workos/migrations package's Commander program, these names should be verified against the package. The test at src/utils/help-json.spec.ts:139-140 asserts process-roles is present and process-role-definitions is absent, but doesn't verify against the actual package. If the package still registers process-role-definitions, the help output will be wrong.
(Refers to lines 1431-1443)
Was this helpful? React with 👍 or 👎 to provide feedback.
Greptile SummaryThis PR updates CLI copy so command hints and credential messages match the way users invoke the CLI. The main changes are:
Confidence Score: 4/5Safe to merge after addressing the non-blocking guard coverage gap. The runtime changes are mostly messaging and source threading with broad test coverage. The remaining issue affects future regression coverage, not current command behavior.
What T-Rex did
Important Files Changed
|
| const HINT_RE = | ||
| /\bworkos (?:auth|env|config|telemetry|doctor|install|uninstall|vault|api|seed|mcp|skills|debug|organization|org|user|migrations|login|logout|whoami|dev)\b/g; |
There was a problem hiding this comment.
Expand guard coverage
HINT_RE omits several live top-level resource commands from the help registry, so the new regression guard does not fail for hardcoded hints like workos role list, workos permission list, workos membership list, or workos invitation list. That leaves part of the CLI outside the npx-aware hint protection this test is meant to enforce.
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/utils/command-hints-guard.spec.ts
Line: 14-15
Comment:
**Expand guard coverage**
`HINT_RE` omits several live top-level resource commands from the help registry, so the new regression guard does not fail for hardcoded hints like `workos role list`, `workos permission list`, `workos membership list`, or `workos invitation list`. That leaves part of the CLI outside the npx-aware hint protection this test is meant to enforce.
How can I resolve this? If you propose a fix, please make it concise.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
|
Closing in favor of a single combined PR from nicknisi/akshay. |
What
workos <subcommand>hints through the npx-awareformatWorkOSCommand/getWorkOSCommandhelper (the env claim/add/list family,exitWithErrormessages, doctor/dev/seed/api/vault-run sites, and the migrations Commander program name), so hints render in the form the user actually invoked.command-hints-guard.spec.ts) that scans the source tree for new hardcoded hints, with a curated allowlist for static help examples and prose matches — future hint sites failpnpm testunless routed through the helper.staging:successsource field) to both adapters, so auto-provisioned/stored/device paths say what really happened.env removehelp states it only deletes local config (it read like an unclaim);env claimhelp/output states claiming is permanent and one-way.MIGRATIONS_DESCRIPTIONconstant betweenbin.tsandhelp-json.ts, reconciled with @workos/migrations v2.5.0 subcommands.Why
From the friction log: hints told users to run a global
workosbinary npx never installed, "provided credentials" printed on the auto-provisioned path, andenv removelooked like it released the environment remotely. Each is small; together they erode trust in everything else the CLI prints.Testing
Notes
recovery.hints[].commandchannel) was deferred — the npx-aware interpolation already closes the copy-paste friction.Stack 4/7 (
akshay-friction-log): merge after #187, then rebase ontomain.